package com.queclink.ycm.entity.data.useless;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.queclink.ycm.common.utils.HexUtils;
import com.queclink.ycm.entity.data.Data;

/**
 * @author jim.li
 * @email jim.li@queclink.com
 * @date 2021-12-27 11:07:00
 */
public class Data19 extends Data {

    private String TriggeredTime;

    @JSONField(
            name = "TriggeredTime"
    )
    public String getTriggeredTime(JSONObject jsonObject) {
        StringBuffer sb = new StringBuffer();
        String utcTime = jsonObject.getString("TriggeredTime");
        String s = HexUtils.LongStrToHex(utcTime, 8);
        sb.append(s);
        return sb.toString();
    }

    public void setTriggeredTime(String triggeredTime) {
        this.TriggeredTime = triggeredTime;
    }

    public String getDataID() {
        // data19
        return "13";
    }

    public String getLength() {
        return "04";
    }

    @Override
    public String combine(JSONObject jsonObject) throws Exception {
        StringBuffer sb = new StringBuffer();
        sb.append(this.getDataID());
        sb.append(this.getLength());
        sb.append(this.getTriggeredTime(jsonObject));
        return sb.toString();
    }
}
